#!/usr/bin/env python
# coding=utf-8
__author__ = 'revol'

import unittest

from log2mongo import L2M, Levels


class l2mTest(unittest.TestCase):
    def setUp(self):
        self.config = {'host': '192.168.1.121',
                       'port': 27017,
                       'username': 'test',
                       'password': '123',
                       'database': 'test',
                       'collection': 'clog'}

    def test_basicconfig(self):
        L2M.basicConfig(self.config)
        L2M.basicConfig({'level': Levels.DEBUG})
        l2m = L2M.getLogger()
        self.assertEqual(l2m.config.get('level'), Levels.DEBUG)
        l2m.error(IOError('testError'),{'eee':1,'vvv':2},a=1,b=2)
        l2m.cache(dict(a=1,b=2))

if __name__ == '__main__':
    unittest.main()
